﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

/*
namespace HotelManager
{
    public class OCRScanner
    {
        public static Tesseract Scanner;

        static OCRScanner()
        {
            if (OCRScanner.Scanner == null)
            {
                Scanner = new Tesseract("tessdata", "eng", Tesseract.OcrEngineMode.OEM_DEFAULT);
            }
        }

        public string Scan()
        {
            Image<Bgr, byte> image = new Image<Bgr, byte>(@"..\..\test.jpg");
            
            Scanner.Recognize<Bgr>(image);

            return RefineScanInfo(Scanner.GetText());
        }

        private string RefineScanInfo(string input)
        {
            StringBuilder result = new StringBuilder();

            string[] inputSplit = input.Split('\n');

            foreach (var item in inputSplit)
            {
                if (item.Contains('<'))
                {
                    result.AppendLine(item);
                }
            }

            for (int i = 0; i < result.Length; i++)
            {
                char currentChar = result[i];

                if (!char.IsLetterOrDigit(currentChar) && currentChar != '\n' && currentChar != '<')
                {
                    result.Remove(i, 1);
                    i--;
                }
            }

            return result.ToString();
        }
    }
}
*/